package com.test.study.ToolsUtils.strom.trident;

import org.apache.storm.trident.operation.BaseFunction;
import org.apache.storm.trident.operation.TridentCollector;
import org.apache.storm.trident.tuple.TridentTuple;
import org.apache.storm.tuple.Values;

public class SplitFunction extends BaseFunction {

	/**
	 * 
	 */
	private static final long serialVersionUID = -4774963747040225286L;

	@Override
	public void execute(TridentTuple tuple, TridentCollector collector) {
		String line = tuple.getStringByField("line");
		if (line != null) {
			String[] split = line.split("\t");
			if (split != null && split.length > 0) {
				for (String word : split) {
					collector.emit(new Values(word));

				}
			}
		}

	}

}
